package model

type SysOrg struct {
	DcModel
	//ParentCode 对应 OrgCode
	ParentCode   string       `json:"parent_code" gorm:"comment:父组织OrgCode;index;"`
	OrgCode      string       `json:"org_code" gorm:"comment:组织编码;not null;uniqueIndex;"`
	OrgName      string       `json:"org_name" gorm:"comment:组织名称;not null;index;"`
	OrgLevel     string       `json:"org_level" gorm:"comment:组织级别;"`
	EdaCode      string       `json:"eda_code" gorm:"comment:EDA编码;index;"`
	EdaId        string       `json:"eda_id" gorm:"comment:EDAID;index;"`
	MktAreaId    string       `json:"mkt_area_id" gorm:"comment:三级单元EDAID;index;"`
	MktAreaName  string       `json:"mkt_area_name" gorm:"comment:三级单元名称;index;"`
	DeptId       string       `json:"dept_id" gorm:"comment:四级单元EDAID;index;"`
	DeptName     string       `json:"dept_name" gorm:"comment:四级单元名称;index;"`
	GroupId      string       `json:"group_id" gorm:"comment:组EDAID;index;"`
	GroupName    string       `json:"group_name" gorm:"comment:组名称;index;"`
	DutyZoneId   string       `json:"duty_zone_id" gorm:"comment:包区EDAID;index;"`
	DutyZoneName string       `json:"duty_zone_name" gorm:"comment:包区名称;index;"`
	RegionId     string       `json:"region_id" gorm:"comment:网格EDAID;index;"`
	RegionName   string       `json:"region_name" gorm:"comment:网格名称;index;"`
	Role         []SysRole    `json:"role" gorm:"many2many:sys_org_role;foreignKey:OrgCode;joinForeignKey:OrgCode;references:RoleCode;joinReferences:RoleCode;"`
	OrgRole      []SysOrgRole `json:"org_role" gorm:"foreignKey:OrgCode;references:OrgCode"` //org has many org_role
}

type RequestGetOrgList struct {
	RequestPageAndSort
	OrgCode      string `json:"org_code"`
	OrgName      string `json:"org_name"`
	OrgLevel     string `json:"org_level"`
	EdaCode      string `json:"eda_code"`
	MktAreaName  string `json:"mkt_area_name"`
	DeptName     string `json:"dept_name"`
	GroupName    string `json:"group_name"`
	DutyZoneName string `json:"duty_zone_name"`
	RegionName   string `json:"region_name"`
}

type RequestOrgCode struct {
	OrgCode string `json:"org_code"`
}

type RequestOrgRole struct {
	OrgCode  string `json:"org_code"`
	RoleCode string `json:"role_code"`
}

type RequestOrgRoleAdd struct {
	OrgCode  string   `json:"org_code"`
	RoleCode []string `json:"role_code"`
}
